import React from 'react'
import useReducer from "../../hooks/useReducer";
const HooksPages = () =>{

  const [state,dispatch] = useReducer( {
    count: 0,
  })
  const { count} = state;
  const add = () => {
    dispatch({
      count: count + 1,
    })
  }
  const sub = () => {
    dispatch({
      count: count - 1,
    })
  }
  return (
    <div>
        <button onClick={add}>按钮1</button>
        <button onClick={sub}>按钮2</button>
        <div>{count}</div>
    </div> 
  )
}
export default HooksPages;